package com.example.win.android_banduyujia.peopleactivity.activity.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.example.win.android_banduyujia.R;
import com.example.win.android_banduyujia.venuesactivity.activity.GroupActivity;

/**
 * Created by Win on 2015/8/5.
 */
public class WelcomeActivity extends Activity implements View.OnClickListener {

    private ImageView   mImageVenues;
    private ImageView   mImagePeople;

    private AnimationDrawable  mAnimationDrawable;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        InitViews();
    }

    private void InitViews() {
        mImageVenues = (ImageView) findViewById(R.id.welcome_image_view_venues);
        mImagePeople = (ImageView) findViewById(R.id.welcome_image_view_people);

        ImageView mLinearImageLayout = (ImageView) findViewById(R.id.background_frame);
        mLinearImageLayout.setBackgroundResource(R.drawable.background_image_frame);
        mAnimationDrawable= (AnimationDrawable) mLinearImageLayout.getBackground();

        mImageVenues.setOnClickListener(this);
        mImagePeople.setOnClickListener(this);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {

        mAnimationDrawable.start();
        super.onWindowFocusChanged(hasFocus);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.welcome_image_view_venues:
                 gotoMyVenuesActivity();
                break;
            case R.id.welcome_image_view_people:
                gotoMyTearchActivity();
                break;
        }
    }

    private void gotoMyVenuesActivity() {
        startActivity(new Intent(WelcomeActivity.this, GroupActivity.class));
    }

    private void gotoMyTearchActivity() {
         startActivity(new Intent(WelcomeActivity.this, PerfectActivity.class));
    }
}
